package cn.jly.spring.annotation.ioc.config;

import cn.jly.spring.annotation.ioc.bean.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;

/**
 * @author lanyangji
 * @description spring配置类
 * @date 2020/11/12 上午 8:39
 */
//@Configuration
@ComponentScan(
        basePackages = {"cn.jly.spring.annotation.ioc"},
        //excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class})}
        includeFilters = {
//                @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class}),
//                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {BookService.class}),
                @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})
        },
        useDefaultFilters = false // 这个要配合includeFilters使用
)
public class MainConfig {
    @Bean
    public Person person() {
        return new Person("tom", 23);
    }
}
